﻿using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;

namespace BlogDemo.Infrastructure.Dtos
{
    public class PostInputDtoValidator
         : AbstractValidator<PostInputDto>
    {
        public PostInputDtoValidator()
        {
            RuleFor(t => t.Author)
                .NotNull()
                .NotEmpty()
                .WithName("作者")
                .WithMessage("{PropertyName}是必填项！")
                .MaximumLength(50)
                .WithMessage("{PropertyName}最大长度是{MaxLength}");
        }
    }
}
